package cn.tsinghua.comsmacitccntsinghua.utils;

import android.content.Context;
import android.content.Intent;
import android.util.Log;

import cn.tsinghua.comsmacitccntsinghua.service.KillSelfService;

/**
 * @Author yjl
 * @create 2021/10/22 14:49
 */
public class RestartAppUtil {

    public static final String TAG = "RestartAppUtil";
    public static void restartApp(Context context,long delayTime){
        Log.i(TAG,"restartApp ---- " +"延时" + String.valueOf(delayTime));
        Intent intent = new Intent(context,KillSelfService.class);
        context.startService(intent);//开启此ervice后四秒钟重启
        android.os.Process.killProcess(android.os.Process.myPid());//杀死自己
    }


}
